import {
  getAction,
  deleteAction,
  putAction,
  postAction,
  httpAction
} from '@/api/manage'
const gateway = '/gateway/api'
const cus = '/gateway/api/admin/customer'
const askBox = '/gateway/api/admin/customerAskBox'

const querySysCateTree = (pcod) => getAction('/sys/category/querySysCateTree?async=true&code=' + pcod) // 分类标签
// 地址相关
const getAreaData = () => getAction(cus + '/getAreaData') // 省市区数据
const selectLogistics = (unionId) => getAction(cus + '/selectLogistics?unionId=' + unionId) // 查看顾客地址列表
const saveLogistic = (params) => postAction(cus + '/saveLogistic', params) // 保存地址修改数据
const delLogisticsById = (id) => getAction(cus + '/delLogisticsById?id=' + id) // 删除用户地址
const getCustomerDefLogistic = (customerAskId, unionId) => getAction(`${askBox}/getCustomerDefLogistic?customerAskId=${customerAskId}&unionId=${unionId}`) // 获取默认地址
// 顾客相关
const selectById = (unionId, cardNo) => getAction(cus + '/selectById?unionId=' + unionId + '&cardNo=' + cardNo) // 查询顾客详情

const getGroupOrder = (params) => postAction(cus + '/getGroupOrder', params) // 获取集团消费记录
const askBoxList = (params) => postAction(cus + '/askBoxList', params) // 用户主动要盒记录
const boxList = (params) => postAction(cus + '/boxList', params) // 用户服务单记录
const batchGetProductPromotionPrice = (params) => postAction(gateway + '/corp/product/batchGetProductPromotionPrice', params) //查询单品促销价格
const findStateListByType = (params) => postAction(gateway + '/admin/state/findStateListByType', params) // 根据type获取服务单状态list
// 打印数据
const getBoxPrintData = (params) => postAction('/gateway/api/openapi/product/getBoxPrintData', params) // 获取box打印数据
const createPrintQrCode = (params) => getAction(gateway + '/admin/styling/createPrintQrCode/' + params) // 生成打印单二维码
export {
  getAreaData,
  selectLogistics,
  saveLogistic,
  delLogisticsById,
  getCustomerDefLogistic,
  selectById,
  getGroupOrder,
  askBoxList,
  boxList,
  getBoxPrintData,
  batchGetProductPromotionPrice,
  findStateListByType,
  querySysCateTree,
  createPrintQrCode
}
export const getUserClassification = () => postAction(gateway + '/admin/state/getUserClassification') // 获取用户分类

export const userIsBlack = (params) => postAction(gateway + '/openapi/user/userIsBlack', params) // 根据unionid查询当前用户是否是黑名单